#pragma once
#include<iostream>
#include"Potorol.hpp"

class Cal
{
public:
    Response Excute(Request& req)
    {
        Response resp(0,0);
        
        switch (req.Oper())
        {
        case '+':
            resp.SetRes(req.X()+req.Y());
            break;
        case '-':
            resp.SetRes(req.X()-req.Y());
            break;
        case '/':
            if(req.Y()==0)
                resp.SetCode(1);
            else
                resp.SetRes(req.X()/req.Y());
            break;
        case '*':
            resp.SetRes(req.X()*req.Y());
            break;
        case '%':
            if(req.Y()==0)
                resp.SetCode(2);
            else
                resp.SetRes(req.X()%req.Y());
            break;
        default:
            resp.SetCode(3);
            break;
        }

        return resp;
    }
    

};